<template>
  <div class="app-container">
    <el-tabs v-model="currentTabName" @tab-click="handleClick">
      <el-tab-pane label="礼包列表" name="List">
        <List v-if="currentTabName === 'List'" />
      </el-tab-pane>
      <el-tab-pane v-if="checkPermission(permissionRoles.gift_code_list)" label="礼包码管理" name="Code">
        <GiftCode v-if="currentTabName === 'Code'" />
      </el-tab-pane>
      <el-tab-pane v-if="checkPermission(permissionRoles.gift_use_log)" label="礼包使用日志" name="Log">
        <Log v-if="currentTabName === 'Log'" />
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script>
import checkPermission from '@/utils/permission'
import List from './components/list'
import GiftCode from './components/code'
import Log from './components/log'

export default {
  name: 'Gift',
  components: { List, GiftCode, Log },
  data() {
    return {
      permissionRoles: this.$store.state.user.permissionRoles,
      currentTabName: 'List'
    }
  },
  methods: {
    checkPermission,
    handleClick() {}
  }
}
</script>
